<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
	<th:block th:include="include :: header('新增项目')" />
	<th:block th:include="include :: datetimepicker-css" />
	<style type="text/css">
	.form-group {
    	margin-bottom: 5px;
    	margin-top: 5px;
	}
	</style>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-hxProject-add">
			 <div class="form-group">	
				<label class="col-xs-2 control-label">项目名称：</label>
				<div class="col-xs-3">
					<input class="form-control" id="proname" name="proname"  required />
				</div>
				<label class="col-xs-2 control-label">负责人：</label>
				<div class="col-xs-3">
					<input id="manager" name="manager" class="form-control" type="text" required>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-xs-2 control-label">项目类型：</label>
				<div class="col-xs-3">
					<select name="type" class="form-control m-b" th:with="type=${@dict.getType('hx_project_type')}">
				          <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	              </select>
				</div>
			   <label class="col-xs-2 control-label">项目状态：</label>
				<div class="col-xs-3">
					<select name="status" class="form-control m-b" th:with="type=${@dict.getType('hx_project_status')}">
				          <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
	              </select>
				</div>
			</div>
			<div class="form-group">	
				<label class="col-xs-2 control-label">开始时间：</label>
				<div class="col-xs-3">
				 <div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                         <input type="text" class="form-control" id="startDate" name="startDate" required>
                  </div>
                   </div>
                 <label class="col-xs-2 control-label">结束时间：</label>
				<div class="col-xs-3">
				<div class="input-group date">
                         <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                         <input type="text" class="form-control" id="endDate" name="endDate" required>
                  </div>
                  </div>
			</div>
			<div class="form-group">	
				<label class="col-xs-2 control-label">参与成员：</label>
				<div class="col-xs-6" style="display: inline-flex;">
					<textarea class="form-control" id="participators-view" name="participators-view" rows="2" cols="" readonly="readonly" required></textarea>
					<input id="participators" name="participators" type="text" hidden="true">
					<button type="button" class="btn btn-info" onclick="selectUsersToParent()">选择成员</button>
				</div>
			</div>
		   <div class="form-group">	
				<label class="col-xs-2 control-label">项目描述：</label>
				<div class="col-xs-6">
					<textarea class="form-control" id="prodesc" name="prodesc" rows="5" cols="" required></textarea>
				</div>
			</div>
			
		</form>
	</div>
    <div th:include="include::footer"></div>
    <th:block th:include="include :: datetimepicker-js" />
    <script type="text/javascript">
		
    $(function(){
    	// $(".form-group").addClass("inputM");
    	
    	 //$("#form-hxProject-add").find("form-group").addClass();
    	
	    $("#startDate").datetimepicker({
	    		minView: "month", //选择日期后，不会再跳转去选择时分秒    
	    		format: "yyyy-mm-dd",
			    startView: 2,
			    todayBtn:  1,
		        todayHighlight: 1,
			    autoclose: true
			    
			});
	    $("#endDate").datetimepicker({
	    	minView: "month",
		    format: "yyyy-mm-dd",
		    startView: 2,
		    todayBtn:  1,
	        todayHighlight: 1,
		    autoclose: true
		});
    });
    
    var prefix = ctx + "system/hxProject"
    
		$("#form-hxProject-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			},
			focusCleanup: true
		});
		
	function selectUsersToParent(){
		var participators = $('#participators').val();
		$.modal.openFull("选择用户", prefix + "/userListChoose?participators="+participators,800,360);
    }
    
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-hxProject-add').serialize());
	        }
	    }
	</script>
</body>
</html>
